import instance from '../utils/request'
// 文章详情信息
function articleDetailApi (id) {
  return instance({
    url: `/v1_0/articles/${id}`,
    method: 'GET',
    // params: data,
    needToken: true
  })
}
// 关注
function CollectApi (data) {
  return instance({
    url: '/v1_0/user/followings',
    method: 'POST',
    data: data,
    needToken: true
  })
}
// 取消关注
function disCollectApi (data) {
  return instance({
    url: `/v1_0/user/followings/${data}`,
    method: 'DELETE',
    needToken: true
  })
}
// 文章点赞
function starApi (data) {
  return instance({
    url: '/v1_0/article/likings',
    method: 'POST',
    data: data,
    needToken: true
  })
}
// 取消文章点赞
function disStarApi (data) {
  return instance({
    url: `/v1_0/article/likings/${data}`,
    method: 'DELETE',
    // params: data
    needToken: true
  })
}
// 文章不喜欢
function disLikeApi (data) {
  return instance({
    url: '/v1_0/article/dislikes',
    method: 'POST',
    data: data,
    needToken: true
  })
}
// 取消文章不喜欢
function _disLikeApi (data) {
  return instance({
    url: `/v1_0/article/dislikes/${data}`,
    method: 'DELETE',
    needToken: true
  })
}
// 获取评论或评论回复
function getCommentApi (obj) {
  return instance({
    url: '/v1_0/comments',
    method: 'GET',
    params: obj,
    needToken: true
  })
}
// 添加评论或评论回复
function addCommentApi (obj) {
  return instance({
    url: '/v1_0/comments',
    method: 'POST',
    data: obj,
    needToken: true
  })
}
// 评论点赞
function comStarApi (obj) {
  return instance({
    url: '/v1_0/comment/likings',
    method: 'POST',
    data: obj,
    needToken: true
  })
}
// 取消评论点赞
function uncomStarApi (data) {
  return instance({
    url: `/v1_0/comment/likings/${data}`,
    method: 'DELETE',
    needToken: true
  })
}
export {
  articleDetailApi,
  CollectApi,
  disCollectApi,
  starApi,
  disStarApi,
  disLikeApi,
  _disLikeApi,
  getCommentApi,
  addCommentApi,
  comStarApi,
  uncomStarApi
}
